package com.binest.projectInvestDetails.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.binest.common.annotation.Log;
import com.binest.common.core.controller.BaseController;
import com.binest.common.core.domain.AjaxResult;
import com.binest.common.enums.BusinessType;
import com.binest.projectInvestDetails.domain.ProjectInvestDetails;
import com.binest.projectInvestDetails.service.IProjectInvestDetailsService;
import com.binest.common.utils.poi.ExcelUtil;
import com.binest.common.core.page.TableDataInfo;

/**
 * 项目投资机构详情Controller
 * 
 * @author wwd
 * @date 2024-01-24
 */
@RestController
@RequestMapping("/projectInvestDetails")
public class ProjectInvestDetailsController extends BaseController
{
    @Autowired
    private IProjectInvestDetailsService projectInvestDetailsService;

    /**
     * 查询项目投资机构详情列表
     */
    @PreAuthorize("@ss.hasPermi('projectInvestDetails:projectInvestDetails:list')")
    @GetMapping("/list")
    public TableDataInfo list(ProjectInvestDetails projectInvestDetails)
    {
        startPage();
        List<ProjectInvestDetails> list = projectInvestDetailsService.selectProjectInvestDetailsList(projectInvestDetails);
        return getDataTable(list);
    }

    /**
     * 导出项目投资机构详情列表
     */
    @PreAuthorize("@ss.hasPermi('projectInvestDetails:projectInvestDetails:export')")
    @Log(title = "项目投资机构详情", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, ProjectInvestDetails projectInvestDetails)
    {
        List<ProjectInvestDetails> list = projectInvestDetailsService.selectProjectInvestDetailsList(projectInvestDetails);
        ExcelUtil<ProjectInvestDetails> util = new ExcelUtil<ProjectInvestDetails>(ProjectInvestDetails.class);
        util.exportExcel(response, list, "项目投资机构详情数据");
    }

    /**
     * 获取项目投资机构详情详细信息
     */
    @PreAuthorize("@ss.hasPermi('projectInvestDetails:projectInvestDetails:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") String id)
    {
        return success(projectInvestDetailsService.selectProjectInvestDetailsById(id));
    }

    /**
     * 新增项目投资机构详情
     */
    @PreAuthorize("@ss.hasPermi('projectInvestDetails:projectInvestDetails:add')")
    @Log(title = "项目投资机构详情", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody ProjectInvestDetails projectInvestDetails)
    {
        return toAjax(projectInvestDetailsService.insertProjectInvestDetails(projectInvestDetails));
    }

    /**
     * 修改项目投资机构详情
     */
    @PreAuthorize("@ss.hasPermi('projectInvestDetails:projectInvestDetails:edit')")
    @Log(title = "项目投资机构详情", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody ProjectInvestDetails projectInvestDetails)
    {
        return toAjax(projectInvestDetailsService.updateProjectInvestDetails(projectInvestDetails));
    }

    /**
     * 删除项目投资机构详情
     */
    @PreAuthorize("@ss.hasPermi('projectInvestDetails:projectInvestDetails:remove')")
    @Log(title = "项目投资机构详情", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable String[] ids)
    {
        return toAjax(projectInvestDetailsService.deleteProjectInvestDetailsByIds(ids));
    }
}
